/**
 * 流程图中展示详细信息
 * 显示采集专家录入、审核、编目专家录入、审核页面以及加载数据
 */
function loadAddHtml(){
	$("#taskId_input").val(modifyData["taskId"]);
	$("#processId_input").val(modifyData["processId"]);
	getGcxxHmtl();
	getXzxxHmtl();
	getRwxxHtml();
	getYxxxHtml();
	getWhsxHtml();
	getDbrwHtml();
	getShyjHtml();
}
//馆藏基本信息
function getGcxxHmtl(){
	var html='';
	html+=addInput('collection_code','藏品编号',0,readflag||!checkQx(qxlist,'collection_code',dhbm));
	html+=addInput('organization','保存机构',1,readflag||!checkQx(qxlist,'organization',dhbm));
	html+=addInput('holding_code','馆藏编码',0,readflag||!checkQx(qxlist,'holding_code',dhbm));
	html+=addInput('title','乐器名称',1,readflag||!checkQx(qxlist,'title',dhbm));
	html+=addInput('title_self','自称',0,readflag||!checkQx(qxlist,'title_self',dhbm));
	html+=addInput('phoneticSymbol','音标',1,readflag||!checkQx(qxlist,'phoneticsymbol',dhbm));
	html+=addInput('titleDescription','名称解说词',0,readflag||!checkQx(qxlist,'titledescription',dhbm));
	html+=addSelect('class_bayin','八音分类',1,'mb_gy_byfl',readflag||!checkQx(qxlist,'class_bayin',dhbm));
	html+=addSelectTree('class_huosa','霍萨分类',0,'showhsfl',readflag||!checkQx(qxlist,'class_huosa',dhbm));
	html+=addSelectTree('class_minjian','民间分类',1,'showmjfl',readflag||!checkQx(qxlist,'class_minjian',dhbm));
	html+=addSelectSpecial_nd('year','年代',0,'mb_gy_nd','description',readflag||!checkQx(qxlist,'year',dhbm));
	html+=addInput('birthProcess','传世过程',1,readflag||!checkQx(qxlist,'birthprocess',dhbm));
	html+=addSelect('language','语源',0,'mb_gy_yy',readflag||!checkQx(qxlist,'language',dhbm));
	html+=addSelect('useNation','使用种族',1,'mb_gy_zq',readflag||!checkQx(qxlist,'usenation',dhbm));
	html+=addInput('otherNation','其他种族',0,readflag||!checkQx(qxlist,'othernation',dhbm));
	html+=addInput('unearthedPlace','出土地点',1,readflag||!checkQx(qxlist,'unearthedPlace',dhbm));
	html+=addTextarea('sketch','简述',0,readflag||!checkQx(qxlist,'sketch',dhbm));
	$('#basicDiv').html(html);
}
//形制信息
function getXzxxHmtl(){
	var html='';
	html+=addInput('volume','体量',0,readflag||!checkQx(qxlist,'volume',dhbm));
    html+=addSelectTree('material','材质构成',1,'showMaterial',readflag||!checkQx(qxlist,'material',dhbm));
    html+=addInput('technology','工艺传承',0,readflag||!checkQx(qxlist,'technology',dhbm));
	html+=addInput('improveState','改良状态说明',1,readflag||!checkQx(qxlist,'improveState',dhbm));
	html+=addResource2('formDrawing','形制绘图',1,readflag||!checkQx(qxlist,'formDrawing',dhbm));
	html+=addTextarea('formDescription','形制说明',readflag||!checkQx(qxlist,'formDescription',dhbm));
	html+=addResource2('improveStateImage','改良状态图示',1,readflag||!checkQx(qxlist,'improveStateImage',dhbm));
	$('#shapDiv').html(html);
}
//人文信息
function getRwxxHtml(){
	var html='';
	html+=addTextarea('originDescription','起源说明',readflag||!checkQx(qxlist,'originDescription',dhbm));
	html+=addResource2('originImage','起源图示',1,readflag||!checkQx(qxlist,'originImage',dhbm));
	html+=addResource2('originAudio','起源音频',2,readflag||!checkQx(qxlist,'originAudio',dhbm));
	html+=addResource2('originVideo','起源视频',3,readflag||!checkQx(qxlist,'originVideo',dhbm));
	html+=addTextarea('historyDescription','历史沿革说明',readflag||!checkQx(qxlist,'historyDescription',dhbm));
	html+=addResource2('historyImage','历史沿革图示',1,readflag||!checkQx(qxlist,'historyImage',dhbm));
	html+=addResource2('historyAudio','历史沿革音频',2,readflag||!checkQx(qxlist,'historyAudio',dhbm));
	html+=addResource2('historyVideo','历史沿革视频',3,readflag||!checkQx(qxlist,'historyVideo',dhbm));
	html+=addTextarea('folkloreDescription','民间传说描述',readflag||!checkQx(qxlist,'folkloreDescription',dhbm));
	html+=addResource2('folkloreImage','民间传说图像',1,readflag||!checkQx(qxlist,'folkloreImage',dhbm));
	html+=addResource2('folkloreAudio','民间传说音频',2,readflag||!checkQx(qxlist,'folkloreAudio',dhbm));
	html+=addResource2('folkloreVideo','民间传说视频',3,readflag||!checkQx(qxlist,'folkloreVideo',dhbm));
	html+=addTextarea('faithDescription','宗教信仰',readflag||!checkQx(qxlist,'faithImage',dhbm));
	html+=addResource2('faithImage','宗教信仰图像',1,readflag||!checkQx(qxlist,'faithImage',dhbm));
	html+=addResource2('faithAudio','宗教信仰音频',2,readflag||!checkQx(qxlist,'faithAudio',dhbm));
	html+=addResource2('faithVideo','宗教信仰视频',3,readflag||!checkQx(qxlist,'faithVideo',dhbm));
	html+=addSelect_MultipleLevel('collectionPlace','藏品收藏地',2,"mb_gy_dq",2,readflag||!checkQx(qxlist,'collectionPlace',dhbm));
	html+=addTextarea('treasuresDescription','珍品描述',readflag||!checkQx(qxlist,'treasuresDescription',dhbm));
	$('#literatureDiv').html(html);

	//分级显示收藏地
	
	var url = "MbXtglBaseTableServlet.getPullDataByParent.do";
	var domid = "collectionPlace";
	var tableName="mb_gy_dq";
	if(!readflag&&checkQx(qxlist,'collectionPlace',dhbm)){		
		selectMult(url,domid,tableName,0,1,2);
		setSelect_MultipleLevel(domid,tableName,false);
	}else{
		setSelect_MultipleLevel(domid,tableName,true);
	}
}
//声响信息
function getYxxxHtml(){
	var html='';
	html+=addTextarea('pitch','基音说明',readflag||!checkQx(qxlist,'pitch',dhbm));
	html+=addResource2('pitchAudio','基音音频',2,readflag||!checkQx(qxlist,'pitchAudio',dhbm));
	html+=addTextarea('tone','音列说明',readflag||!checkQx(qxlist,'tone',dhbm));
	html+=addResource2('toneAudio','音列音频',2,readflag||!checkQx(qxlist,'toneAudio',dhbm));
	html+=addTextarea('temperament','乐律说明',readflag||!checkQx(qxlist,'temperament',dhbm));
	html+=addResource2('temperamentAudio','乐律音频',2,readflag||!checkQx(qxlist,'temperamentAudio',dhbm));
	html+=addTextarea('rangeExplain','音域说明',readflag||!checkQx(qxlist,'rangeExplain',dhbm));
	html+=addResource2('rangeAudio','音域音频',2,readflag||!checkQx(qxlist,'rangeAudio',dhbm));
	html+=addTextarea('bestRegister','最佳音区说明',readflag||!checkQx(qxlist,'bestRegister',dhbm));
	html+=addResource2('bestRegisterAudio','最佳音区音频',2,readflag||!checkQx(qxlist,'bestRegisterAudio',dhbm));
	html+=addTextarea('toneMethod','调音法说明',readflag||!checkQx(qxlist,'toneMethod',dhbm));
	html+=addResource2('toneMethodAudio','调音法视频',2,readflag||!checkQx(qxlist,'toneMethodAudio',dhbm));
	html+=addTextarea('voiceMechanism','发音机制描述',readflag||!checkQx(qxlist,'voiceMechanism',dhbm));
	html+=addResource2('voiceMechanismVideo','发音机制视频',3,readflag||!checkQx(qxlist,'voiceMechanismVideo',dhbm));
	html+=addTextarea('ousticMechanism','数据截点为声源发声机制',readflag||!checkQx(qxlist,'ousticMechanism',dhbm));
	html+=addTextarea('provoke','声源原始激起说明',readflag||!checkQx(qxlist,'provoke',dhbm));
	html+=addResource2('provokeVideo','声源原始激起视频',3,readflag||!checkQx(qxlist,'provokeVideo',dhbm));
	html+=addTextarea('struct','声源结构说明',readflag||!checkQx(qxlist,'struct',dhbm));
	html+=addResource2('structImage','声源结构图示',1,readflag||!checkQx(qxlist,'structImage',dhbm));
	html+=addResource2('structVideo','声源结构视频',3,readflag||!checkQx(qxlist,'structVideo',dhbm));
	html+=addTextarea('soundMaterial','声源材质',readflag||!checkQx(qxlist,'soundMaterial',dhbm));
	html+=addTextarea('mediatorMaterial','中介物材质说明',readflag||!checkQx(qxlist,'mediatorMaterial',dhbm));
	html+=addResource2('mediatorMaterialImage','中介物材质图示',1,readflag||!checkQx(qxlist,'mediatorMaterialImage',dhbm));
	html+=addTextarea('mediatorStruct','中介物结构说明',readflag||!checkQx(qxlist,'mediatorStruct',dhbm));
	html+=addResource2('mediatorStructImage','中介物结构图示',1,readflag||!checkQx(qxlist,'mediatorStructImage',dhbm));
	html+=addTextarea('mediatorShape','中介物形制说明',readflag||!checkQx(qxlist,'mediatorShape',dhbm));
	html+=addResource2('mediatorShapeAudio','中介物形制音频',2,readflag||!checkQx(qxlist,'mediatorShapeAudio',dhbm));
	html+=addTextarea('vibrationTransferMaterial','传震物材质说明',readflag||!checkQx(qxlist,'vibrationTransferMaterial',dhbm));
	html+=addResource2('vibrationTransferMaterialImage','传震物材质图示',1,readflag||!checkQx(qxlist,'vibrationTransferMaterialImage',dhbm));
	html+=addTextarea('vibrationTransferStruct','传震物结构说明',readflag||!checkQx(qxlist,'vibrationTransferStruct',dhbm));
	html+=addResource2('vibrationTransferStructImage','传震物结构图示',1,readflag||!checkQx(qxlist,'vibrationTransferStructImage',dhbm));
	html+=addTextarea('resonatorMaterial','共鸣器材质说明',readflag||!checkQx(qxlist,'resonatorMaterial',dhbm));
	html+=addResource2('resonatorMaterialImage','共鸣器材质图示',1,readflag||!checkQx(qxlist,'resonatorMaterialImage',dhbm));
	html+=addTextarea('resonatorStrut','共鸣器结构说明',readflag||!checkQx(qxlist,'resonatorStrut',dhbm));
	html+=addResource2('resonatorStrutImage','共鸣器结构图示',1,readflag||!checkQx(qxlist,'resonatorStrutImage',dhbm));
	html+=addTextarea('mainPartSound','主要结构部位音质说明',readflag||!checkQx(qxlist,'mainPartSound',dhbm));
	html+=addResource2('mainPartSoundAudio','主要结构部位音质音频',2,readflag||!checkQx(qxlist,'mainPartSoundAudio',dhbm));
	html+=addTextarea('techniques','主要演奏技法音质说明',readflag||!checkQx(qxlist,'techniques',dhbm));
	html+=addResource2('techniquesVideo','主要演奏技法音质视频',3,readflag||!checkQx(qxlist,'techniquesVideo',dhbm));
	html+=addTextarea('spectrum','主要演奏技法音质图表及频谱说明',readflag||!checkQx(qxlist,'spectrum',dhbm));
	html+=addResource2('spectrumImage','主要演奏技法音质图表及频谱图示',1,readflag||!checkQx(qxlist,'spectrumImage',dhbm));
	html+=addTextarea('spectrumAnalysis','频谱分析说明',readflag||!checkQx(qxlist,'spectrumAnalysis',dhbm));
	html+=addResource2('spectrumAnalysisImage','频谱分析说明图示',1,readflag||!checkQx(qxlist,'spectrumAnalysisImage',dhbm));
	$('#soundDiv').html(html);
}
//文化信息
function getWhsxHtml(){
	/*var html='';
	html+=addSelect('instrumentType','乐器种类',1,'mb_gy_yqzl',readflag||!checkQx(qxlist,'collection_code',dhbm));
	html+=addInput('songster','作曲者',0,readflag||!checkQx(qxlist,'collection_code',dhbm));
	html+=addInput('lyricist','作词者',1,readflag||!checkQx(qxlist,'collection_code',dhbm));
	html+=addInput('performingForms','演奏形式',0,readflag||!checkQx(qxlist,'collection_code',dhbm));
	html+=addInput('playForm','演奏形态',1,readflag||!checkQx(qxlist,'collection_code',dhbm));
	html+=addInput('performer','表演者',0,readflag||!checkQx(qxlist,'collection_code',dhbm));
	html+=addInput('genre','流派',1,readflag||!checkQx(qxlist,'collection_code',dhbm));
	html+=addInput('toPlayClub','演奏社团',0,readflag||!checkQx(qxlist,'collection_code',dhbm));
	html+=addInput('musicScoreExplain','谱例资料说明',1,readflag||!checkQx(qxlist,'collection_code',dhbm));
	html+=addResource2('musicScoreImage','谱例资料图片',1,readflag||!checkQx(qxlist,'collection_code',dhbm));
	html+=addInput('inheritTeachExplain','传承教学说明',2,readflag||!checkQx(qxlist,'collection_code',dhbm));
	html+=addResource2('inheritTeachVideo','传承教学视频',3,readflag||!checkQx(qxlist,'collection_code',dhbm));
	html+=addInput('symbolsAndTaboos','象征与禁忌',0,readflag||!checkQx(qxlist,'collection_code',dhbm));
	html+=addInput('socialFunction','社会功能',1,readflag||!checkQx(qxlist,'collection_code',dhbm));
	html+=addInput('culturalRole','文化角色',0,readflag||!checkQx(qxlist,'culturalRole',dhbm));
	html+=addInput('culturalFunction','文化功能',1,readflag||!checkQx(qxlist,'culturalFunction',dhbm));
	html+=addInput('culturalContext','文化语境',2,readflag||!checkQx(qxlist,'culturalContext',dhbm));
	$('#cultureDiv').html(html);
	imgInput('#musicScoreImage','');
	videoInput('#inheritTeachVideo','');*/
	var qxflag = checkQx(qxlist,'whsx',dhbm);
	var columns=[ 
	             { title: '乐器种类', field: "instrumentType_text"},
	             { title: '演奏形式', field: 'performingForms'},
	             { title: '演奏形态', field: 'playForm'},
	             { title: '表演者', field: 'performer'},
	             { title: '流派', field: 'genre'},
	             { title: '操作', formatter:function(value,row,index){
              	   if(qxflag){
              		   html = "<a href='#' onclick='showWhsx("+row.id+")'>编辑</a>&nbsp;" +
              		   		"<a href='#' onclick='delWhsx("+row.id+")'>删除</a>"
              			return html;
              		}else{

             		   html = "<a href='#' onclick='showWhsx("+row.id+")'>查看</a>&nbsp;";
             			return html;
         		}
	             }}
	             ];
	var url = "";
	if(processDefKey=="minbocaiji")
		url = "/cnmuseum/cj/whsxlist";
	else
		url = "/cnmuseum/bm/whsxlist";
	createTableWithOutPage('#whsx-table',url,"",columns,{"task_id":modifyData["taskId"]});

	if(qxflag){
		$("#btn_addWhsx").show();
	}
	
}
//代表人物信息
function getDbrwHtml(){
	/*var html='';
	html+=addInput('name','人物名称',2,readflag||!checkQx(qxlist,'name',dhbm));
	html+=addInput('dbrwYear','年代',2,readflag||!checkQx(qxlist,'dbrwYear',dhbm));
	html+=addTextarea('contribution','贡献',readflag||!checkQx(qxlist,'contribution',dhbm));
	html+=addInput('representativeworks','代表著作',2,readflag||!checkQx(qxlist,'representativeworks',dhbm));
	$('#representationDiv').html(html);*/
	

	var qxflag = checkQx(qxlist,'dbrw',dhbm);
	var columns=[ 
	                   { title: '人物名称', field: "name"},
	                   { title: '年代', field: 'dbrwYear'},
	                   { title: '贡献', field: 'contribution'},
	                   { title: '代表著作', field: 'representativeworks'},
	                   { title: '操作', formatter:function(value,row,index){
	                	   if(qxflag){
	                		   html = "<a href='#' onclick='showDbrw("+row.id+")'>编辑</a>&nbsp;" +
	                		   		"<a href='#' onclick='delDbrw("+row.id+")'>删除</a>"
	                			return html;
	                		}else{

		                		   html = "<a href='#' onclick='showDbrw("+row.id+")'>查看</a>&nbsp;";
		                			return html;
	                		}
	                   }}
	                   ];
	var url = "";
	if(processDefKey=="minbocaiji")
		url = "/cnmuseum/cj/dbrwlist";
	else
		url = "/cnmuseum/bm/dbrwlist";
	createTableWithOutPage('#dbrw-table',url,"",columns,{"task_id":modifyData["taskId"]});

	if(qxflag){
		$("#btn_addDbrw").show();
	}
}

function showWhsx(zdbh){
	var html='';
	html+=addSelect('instrumentType','乐器种类',1,'mb_gy_yqzl',readflag);
	html+=addInput('songster','作曲者',0,readflag);
	html+=addInput('lyricist','作词者',1,readflag);
	html+=addInput('performingForms','演奏形式',0,readflag);
	html+=addInput('playForm','演奏形态',1,readflag);
	html+=addInput('performer','表演者',0,readflag);
	html+=addInput('genre','流派',1,readflag);
	html+=addInput('toPlayClub','演奏社团',0,readflag);
	html+=addInput('musicScoreExplain','谱例资料说明',1,readflag);
	html+=addResource2('musicScoreImage','谱例资料图片',1,readflag);
	html+=addInput('inheritTeachExplain','传承教学说明',2,readflag);
	html+=addResource2('inheritTeachVideo','传承教学视频',3,readflag);
	html+=addInput('symbolsAndTaboos','象征与禁忌',0,readflag);
	html+=addInput('socialFunction','社会功能',1,readflag);
	html+=addInput('culturalRole','文化角色',0,readflag);
	html+=addInput('culturalFunction','文化功能',1,readflag);
	html+=addInput('culturalContext','文化语境',2,readflag);
	html+= "<input type=text style='display:none' id='whsx_zdbh'  name='whsx_zdbh'>"
	$('#form_whsx').html(html);


	if(zdbh!=null&&zdbh!=undefined){
		var url = "";
		if(processDefKey=="minbocaiji")
			url = "/cnmuseum/cj/whsxdetail";
		else
			url = "/cnmuseum/bm/whsxdetail";
		var result=ajaxResult('GET',false,url,{"id":zdbh});
		//var result=ajaxResult('GET',false,"mbWhsxServlet.getWhsxDetailByZdbh.do",{zdbh:zdbh});
		if(result.status=='OK'){
			loadData("#form_whsx",result.data);
			$("#form_whsx input[name=whsx_zdbh]").val(result.data.id);
		}
	}
	
	$('#editWhsxModal').modal('show');
	
	imgInput('#musicScoreImage','');
	videoInput('#inheritTeachVideo','');
}
function saveWhsx(){
	var params=$('#form_whsx').serializeObject();
	var whsx_zdbh = $('#whsx_zdbh').val();
	if(whsx_zdbh!=""){		
		params.id = whsx_zdbh;
	}
	params.taskId = modifyData["taskId"];
	params.processId = modifyData["processId"];
	
	var url = "";
	if(processDefKey=="minbocaiji")
		url = "/cnmuseum/cj/savewhsx";
	else
		url = "/cnmuseum/bm/savewhsx";
	var result=ajaxResult('POST',false,url,params);
	//var result=ajaxResult('POST',false,"mbWhsxServlet.saveWhsx.do",params);
	if(result.status=='OK'){
		$('#editWhsxModal').modal('hide');
		$('#whsx-table').bootstrapTable('refresh');
	}
}
function delWhsx(zdbh){
	var url = "";
	if(processDefKey=="minbocaiji")
		url = "/cnmuseum/cj/deletewhsx";
	else
		url = "/cnmuseum/bm/deletewhsx";
	var result=ajaxResult('GET',false,url,{id:zdbh});
	//var result=ajaxResult('POST',false,"mbWhsxServlet.delWhsx.do",{"zdbh":zdbh});
	if(result.status=='OK'){
		$('#whsx-table').bootstrapTable('refresh');
	}
}

function showDbrw(zdbh){
	var html='';
	html+=addInput('name','人物名称',2,readflag);
	html+=addInput('dbrwYear','年代',2,readflag);
	html+=addTextarea('contribution','贡献',readflag);
	html+=addInput('representativeworks','代表著作',2,readflag);
	html+= "<input type=text style='display:none' id='dbrw_zdbh'  name='dbrw_zdbh'>"
	$('#form_dbrw').html(html);
	if(zdbh!=null&&zdbh!=undefined){
		var url = "";
		if(processDefKey=="minbocaiji")
			url = "/cnmuseum/cj/dbrwdetail";
		else
			url = "/cnmuseum/bm/dbrwdetail";
				
		var result=ajaxResult('GET',false,url,{"id":zdbh});
		if(result.status=='OK'){
			loadData("#form_dbrw",result.data);
			$("#form_dbrw input[name=dbrw_zdbh]").val(result.data.id);
		}
	}
	$('#editDbrwModal').modal('show');
}
function savedbrw(){
	var params=$('#form_dbrw').serializeObject();
	var dbrw_zdbh = $('#dbrw_zdbh').val();
	if(dbrw_zdbh!=""){		
		params.id = dbrw_zdbh;
	}
	params.taskId = modifyData["taskId"];
	params.processId = modifyData["processId"];

	var url = "";
	if(processDefKey=="minbocaiji")
		url = "/cnmuseum/cj/savedbrw";
	else
		url = "/cnmuseum/bm/savedbrw";
			
	var result=ajaxResult('POST',false,url,params);
	//var result=ajaxResult('POST',false,"mbDbrwServlet.saveDbrw.do",params);
	if(result.status=='OK'){
		$('#editDbrwModal').modal('hide');
		$('#dbrw-table').bootstrapTable('refresh');
	}
}
function delDbrw(zdbh){
	var url = "";
	if(processDefKey=="minbocaiji")
		url = "/cnmuseum/cj/deletedbrw";
	else
		url = "/cnmuseum/bm/deletedbrw";
	//var result=ajaxResult('POST',false,"mbDbrwServlet.delDbrw.do",{"zdbh":zdbh});
	var result=ajaxResult('POST',false,url,{"zdbh":zdbh});
	if(result.status=='OK'){
		$('#dbrw-table').bootstrapTable('refresh');
	}
}
//审批意见信息
function getShyjHtml(){
	var adviceColumns=[ 
	                   { title: '序号', width: 50, align: "center", formatter: function (value, row, index) { return index + 1; } },
	                   { title: '建议人', field: 'commentUserText'},
	                   { title: '建议内容', field: 'commentText'},
	                   { title: '时间', field: 'commentTime'}
	                   ];
	var html='';
	//if(type!=null&(type=='cjUser'|type=='bjUser')){
	//	html+=nextflowHtml();
	//}
	html+=addAdviceTextarea('yourAdvice','意见建议');
	html+='<table class="table_list_box" id="adviceList"></table>';
	$('#adviceDiv').html(html);
	var url = "";
	if(processDefKey=="minbocaiji")
		url = "/cnmuseum/cj/commentlist";
	else
		url = "/cnmuseum/bm/commentlist";
	createTableWithOutPage('#adviceList',url,'id',adviceColumns,{"task_id":modifyData["taskId"]},null);
	//createTableWithOutPage('#adviceList','cjFlowServlet.getCommons.do','id',adviceColumns,{"id":modifyData["gcxxid"]},null);
}

function videoInput(selector,url){
	$(selector).fileinput({
        language: 'zh', //设置语言
        uploadUrl:url, //上传的地址
       	allowedFileExtensions: ['mp4', 'RMVB', 'rmvb'],//接收的文件后缀
        showUpload:true, //是否显示上传按钮
        showRemove :true, //显示移除按钮
        showPreview :false, //是否显示预览
       dropZoneEnabled: false,//是否显示拖拽区域
        //maxFileSize:0,//单位为kb，如果为0表示不限制文件大小
       //minFileCount: 0,
        maxFileCount:1, //表示允许同时上传的最大文件个数
   }).on("fileuploaded", function (event, data, previewId, index){

	});
}

function fileuploadInput(selector,url){
	$(selector).fileinput({
        language: 'zh', //设置语言
        uploadUrl:url, //上传的地址
       	//allowedFileExtensions: ['mp4', 'RMVB', 'rmvb'],//接收的文件后缀
        showUpload:true, //是否显示上传按钮
        showRemove :true, //显示移除按钮
        showPreview :false, //是否显示预览
       dropZoneEnabled: false,//是否显示拖拽区域
        //maxFileSize:0,//单位为kb，如果为0表示不限制文件大小
       //minFileCount: 0,
        maxFileCount:1, //表示允许同时上传的最大文件个数
   }).on("fileuploaded", function (event, data, previewId, index){

	});
}

var imgColumn=[ { title: '锁定',width:'8%',checkbox: true},
                { title: '文件',field: 'savePath',formatter: function (value, row, index) {
                	return '<img src="'+value+'" />';
                	/*return '<img src="../img/bg_1.jpg" style="width:50px;height:50px;" />';*/
                }},
                { title: '资源名称',field: 'title'}
            ];
var audioColumn=[ { title: '锁定',width:'8%',checkbox: true},
                { title: '文件',field: 'filename'},
                { title: '资源名称',field: 'title'}
            ];
//flag 1上传影像资源，2上传音频，3视频，4三维模型，5文献，
var resourceInputId;
function chooseResource(id,flag){
	resourceInputId=id;
	var columns;
	if(flag==1){
		columns=imgColumn;
	}else if(flag==2){
		columns=audioColumn;
	}else if(flag==3){
		columns=audioColumn;
	}else if(flag==4){
		columns=audioColumn;
	}else if(flag==5){
		columns=audioColumn;
	}
	$('#resource-table').bootstrapTable('destroy');
	createTableSingleSelect('#resource-table', 'mbmanageresourceservlet.getManageResourceByUser.do', 'id', columns,{type:flag});
	$('#chooseResource').modal('show');
}
var importdatafileid = '';
var importdatafilename = '';
var importurl = '';
var importid = '';
//上传资源 id：上传资源元素id，flag：flag 1上传影像资源，2上传音频，3视频，4三维模型，5文献，
function importResource(id,flag){
	importdatafileid = '';
	importdatafilename = '';
	importid = id;
	var html = '';
	$('#uploadForm').html(html);
	if(flag==1){
		html = getAddModelHtmlImg();
		$('#uploadForm').html(html);
		importurl = "mbmanageimageServlet.insert.do";
		imgInputByCallback('#ccUpload','mbgyfileServlet.insert.do',importFileCallback);
	}if(flag==2){
		html = getAddModelHtmlAudio();
		$('#uploadForm').html(html);
		importurl = "mbmanageaudiofrequencyServlet.insert.do";
		audioInputByCallback('#ccUpload','mbgyfileServlet.insert.do',importFileCallback);
	}if(flag==3){
		html = getAddModelHtmlVideo();
		$('#uploadForm').html(html);
		importurl = "mbmanagevideoServlet.insert.do";
		videoInputByCallback('#ccUpload','mbgyfileServlet.insert.do',importFileCallback);
	}if(flag==4){
		html = getAddModelHtmlThree();
		$('#uploadForm').html(html);
		importurl = "mbmanagethreedimensionalmodelServlet.insert.do";
		fileuploadInputByCallback('#ccUpload','mbgyfileServlet.insert.do',importFileCallback);
	}if(flag==5){
		html = getAddModelHtmlLiterature();
		$('#uploadForm').html(html);
		importurl = "mbmanageliteratureServlet.insert.do";
		fileuploadInputByCallback('#ccUpload','mbgyfileServlet.insert.do',importFileCallback);
	}
	datetime(".form_date1");
	$('#importResource').modal('show');
}

function importFileCallback(event, data, previewId, index){
	if(data.response.status=='OK'){
		importdatafileid=data.response.id;
		importdatafilename=data.filenames[0];
	}else{
		alertFunc(data.response.msg);
	}
}

function addResourceConfirm(){
	var rowArray= $('#resource-table').bootstrapTable('getSelections');
	if(rowArray.length==0){
		alertFunc("请选中一行");
	}else if(rowArray.length>1){
		alertFunc("只能选中一行");
	}else{
		//$('#'+resourceInputId+'1').val(rowArray[0].filename);
		//$('#'+resourceInputId).val(rowArray[0].id);
		$('#'+resourceInputId+'1').val(rowArray[0].title);
		$('#'+resourceInputId).val(rowArray[0].zdbh);
	}
	$('#chooseResource').modal('hide');
	$('#resource-table').bootstrapTable('destroy');
}
function importResourceConfirm(){
	var params = $('#uploadForm').serializeObject();
	if(importdatafileid==null || importdatafileid==""){
		alertFunc("请先上传文件！");
		return false;
	}
	if(params.title==""){
		params.title = importdatafilename;
	}
	params.fileid=importdatafileid;
	
	var result=ajaxResult('post',false,importurl,params);
	if(result.status=='OK'){
		var filezdbh = result.zdbh;
		$("#"+importid).val(filezdbh);
		$("#"+importid+"1").val(result.filetitles);
		$('#importResource').modal('hide');
	}else{
		alertFunc(result.msg);
	}
}

//获取普通select html
function nextflowHtml(){
	var html='';
	html+='<div class="row">';
	html+='<div class="col-md-2 text-right">';
	html+='<span>下一步：</span>';
	html+='</div>';
	html+='<div class="col-md-4">';
	html+='<select id="nextflow" name="nextflow" class="form-control">';
	/*html+='<option value="cj">继续采集</option>';*/
	html+='<option value="lr">返回专家录入</option>';
	html+='<option value="sh">提交审核</option>';
	html+='</select>';
	html+='</div>';
	html+='</div>';
	return html;
}




function getAddModelHtmlImg(){
	var html='';
	html+=addInput_clear('title','名称',0);
	html+=addInput_clear('alternative','交替名称',1);
	html+=addInput_clear('subject','主题',0);
	html+=addInput_clear('description','描述',1);
	html+=addTime('created','拍摄时间',0);
	html+=addTime('discovered','发现日期',1);
	html+=addSelect('medium','记录介质类型',0,'mb_gy_jljzlx');
	html+=addSelect('fileFormat','文件格式',1,'mb_gy_wjgs');
	html+=addSelect('sourceType','采集方式',0,'mb_gy_lyfs');
	html+=addInput_clear('sourceForm','出处',1);
	html+=addSelect('language','语种',0,'mb_gy_cyyz');
	html+=addInput_clear('spacearea','空间范围',1);
	html+=addInput_clear('temporal','时间范围',0);
	html+=addInput_clear('publishe','出版者',1);
	html+=addInput_clear('equipment','采集设备',0);
	html+=addInput_clear('storedin','记录介质保存位置',1);
	html+=addSelect('angel','拍摄角度',2,'mb_gy_psjd');
	html+=addFileput('ccUpload','文件上传',0);
	html+=addSelect('rightsType','资源权限类型',0,'mb_gy_zyqxlx');
	return html;
}

function getAddModelHtmlAudio(){
	var html='';
	html+=addInput_clear('title','名称',0);
	html+=addInput_clear('alternative','交替名称',1);
	html+=addInput_clear('subject','主题',0);
	html+=addInput_clear('description','描述',1);
	html+=addTime('created','拍摄时间',0);
	html+=addTime('discovered','发现日期',1);
	html+=addSelect('medium','记录介质类型',0,'mb_gy_jljzlx');
	html+=addSelect('audioEF','音频编码格式',1,'mb_gy_sxcjgs');
	html+=addSelect('sourceType','采集方式',0,'mb_gy_lyfs');
	html+=addInput_clear('sourceForm','出处',1);
	html+=addSelect('audioChannelLanguage','声道语种',0,'mb_gy_cyyz');
	html+=addSelect('subtitleLanguage','声道语种',1,'mb_gy_cyyz');
	html+=addInput_clear('spacearea','空间范围',0);
	html+=addInput_clear('publishe','出版者',1);
	html+=addInput_clear('temporal','时间范围',0);	
	html+=addInput_clear('equipment','采集设备',1);
	html+=addInput_clear('storedin','记录介质保存位置',0);
	html+=addSelect('angel','拍摄角度',1,'mb_gy_psjd');
	html+=addFileput('ccUpload','文件上传',0);
	html+=addSelect('rightsType','资源权限类型',0,'mb_gy_zyqxlx');
	return html;
}

function getAddModelHtmlVideo(){
	var html='';
	html+=addInput_clear('title','名称',0);
	html+=addInput_clear('alternative','交替名称',1);
	html+=addInput_clear('subject','主题',0);
	html+=addInput_clear('description','描述',1);
	html+=addTime('created','拍摄时间',0);
	html+=addTime('discovered','发现日期',1);
	html+=addSelect('medium','记录介质类型',0,'mb_gy_jljzlx');
	html+=addSelect('audioEF','音频编码格式',1,'mb_gy_sxcjgs');
	html+=addSelect('videoEF','视频编码格式',1,'mb_gy_sxcjgs');
	html+=addSelect('sourceType','采集方式',0,'mb_gy_lyfs');
	html+=addInput_clear('sourceForm','出处',1);
	html+=addSelect('audioChannelLanguage','声道语种',0,'mb_gy_cyyz');
	html+=addSelect('subtitleLanguage','声道语种',1,'mb_gy_cyyz');
	html+=addInput_clear('spacearea','空间范围',0);
	html+=addInput_clear('publishe','出版者',1);
	html+=addInput_clear('temporal','时间范围',0);		
	html+=addInput_clear('equipment','采集设备',1);
	html+=addInput_clear('storedin','记录介质保存位置',0);
	html+=addSelect('angel','拍摄角度',1,'mb_gy_psjd');
	html+=addFileput('ccUpload','文件上传',0);
	html+=addSelect('rightsType','资源权限类型',0,'mb_gy_zyqxlx');
	return html;
}

function getAddModelHtmlThree(){
	var html='';
	html+=addInput_clear('title','名称',0);
	html+=addInput_clear('alternative','交替名称',1);
	html+=addInput_clear('subject','主题',0);
	html+=addInput_clear('description','描述',1);
	html+=addTime('created','拍摄时间',0);
	html+=addInput_clear('collectionunit','采集单位',1);
	html+=addFileput('ccUpload','文件上传',1);
	html+=addSelect('rightsType','资源权限类型',0,'mb_gy_zyqxlx');
	return html;
}

function getAddModelHtmlLiterature(){
	var html='';
	html+=addInput_clear('filename','文件名称',0);
	html+=addInput_clear('author','作者',1);
	html+=addInput_clear('contributor','相关责任人',0);
	html+=addInput_clear('publishingtime','出版时间',1);
	html+=addInput_clear('publishinghouse','出版者',2);
	html+=addFileput('ccUpload','文件上传',0);		
	html+=addSelect('rightsType','资源权限类型',0,'mb_gy_zyqxlx');
	return html;
}


function showhsfl(){
	initSelectModel("Hs","选择霍萨分类","class_huosa",1)
}

function showmjfl(){
	initSelectModel("Mj","选择民间分类","class_minjian",1)
}

function showMaterial() {
    initSelectModel("Cz", "选择材质构成", "material", 2)
}